Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext


~Anita Bubkilynivu 16.Dec.03 07:47 AM a Web browser
Domino Designer 6.0.2 CF2 Windows XP


The following is my programe:
when running it by url,the agent wordks.
But in cliect running the agent at 18:00 everyday doen't work.
I have no idea.


import lotus.domino.*;
import java.net.*;
import java.util.*;
import java.io.*;
import java.text.*;
import java.sql.*;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {

System.out.println("000");

Session session = getSession();
AgentContext agentContext = session.getAgentContext();



Database db = agentContext.getCurrentDatabase();


String dbdriver = "COM.ibm.db2.jdbc.app.DB2Driver";
String dbid = "id";
String dbpsw = "password";
String dburl = "jdbc:db2:host";
Driver drv = (Driver)Class.forName(dbdriver).newInstance();
Connection con = DriverManager.getConnection(dburl,dbid,dbpsw);


String query = "select * from table";


View view = db.getView("Viewname");
Document firstdoc = view.getFirstDocument();
String key_old = firstdoc.getItemValueString("Update_date");
DocumentCollection dc_old = view.getAllDocumentsByKey(key_old);
dc_old rollback


Statement st = con.createStatement();
ResultSet rs = st.executeQuery(query);
DateTime dt = session.createDateTime("Today");

dt.setNow();
String tmpMonth = dt.getDateOnly().substring(0, 2);
String tmpDay = dt.getDateOnly().substring(3, 5);
String tmpYear = dt.getDateOnly().substring(6, dt.getDateOnly().length());

try
{
while(rs.next())
{
Document doc = db.createDocument();
doc.replaceItemValue("item1",String.valueOf(rs.getString("item1")));
doc.replaceItemValue("item2",String.valueOf(rs.getString("item2")));
doc.replaceItemValue("item3",String.valueOf(rs.getString("item3")));
doc.replaceItemValue("Update_date",tmpYear+"/"+tmpMonth+"/"+tmpDay);
doc.save();
}

dc_old.removeAll(true);
}
catch(Exception e)
{
String key_new = tmpYear+"/"+tmpMonth+"/"+tmpDay;
DocumentCollection dc_new = view.getAllDocumentsByKey(key_new);
dc_new.removeAll(true);
}
} catch(Exception e) {
e.printStackTrace();
}
}
}








  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS